import { Modal, Spin } from 'antd';
type Props = {
  children: any;
  open: boolean;
  close: () => void;
  onOk?: (e: any) => void;
  queryLoading?: boolean;
  confirmLoading?: boolean;
  [key: string]: any;
};
export default ({
  children,
  open,
  close,
  onOk,
  queryLoading,
  confirmLoading,
  ...restProps
}: Props) => {
  return (
    <Modal
      open={open}
      onOk={onOk}
      onCancel={close}
      confirmLoading={queryLoading || confirmLoading}
      {...restProps}
    >
      {queryLoading ? <Spin size="large">{children}</Spin> : children}
    </Modal>
  );
};
